package com.zmx.b2c.stock.entity;

import com.zmx.common.common.entitys.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Where;

/**
 * @author zhaomxr
 * null
 */
@Data
@Entity
@Table(name = "product_stock")
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper=true)
@Inheritance(strategy = InheritanceType.JOINED)
@Where(clause = "dr = 0")
public class ProductStock extends BaseEntity {

	/**
	 * 商品id
	 */
	@Column(name = "product_id")
	private Long productId;

	/**
	 * 商品总库存
	 */
	@Column(name = "stock")
	private Integer stock;

	/**
	 * 订单占用库存
	 */
	@Column(name = "order_occupy")
	private Integer orderOccupy;

	/**
	 * 剩余库存
	 */
	@Column(name = "available_stock")
	private Integer availableStock;
}
